<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8">
    <title>Document</title>
  </head>
  <body>
    <script>
      function getRandom(min, max) {
        return Math.floor(Math.random() * (max - min + 1) + min);
      }
      console.log(getRandom(1, 3));	// 最小值1，最大值3
    </script>
  </body>
</html>